package org.yanh.es.redisqueue.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.yanh.es.redisqueue.RedisDelayQueueHandle;
import org.yanh.es.redisqueue.event.TestEvent;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
@Slf4j
public class TestEventHandler implements RedisDelayQueueHandle<TestEvent> {
    @Override
    public void execute(TestEvent testEvent) {
        LocalDateTime now = LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String formattedDateTime = now.format(formatter);
        System.out.println("testEventHandler: " + formattedDateTime + " - " + testEvent.getMsg());
    }
}
